package com.yonyou.brigade.third_parties.ctrip.bigcustomer.util;

import com.yonyou.brigade.third_parties.ctrip.bigcustomer.model.CtripBigUser;
import com.yonyou.ybzboot.uc.dto.UcUserDto;

import java.util.ArrayList;
import java.util.List;

public class UserConvert {
    public static List<CtripBigUser> convertToCtripBigUser(List<UcUserDto> userDtos,String orgPk,String tenant)
    {
        List<CtripBigUser> ctripBigUsers=new ArrayList<>();
        if(userDtos==null)
        {
            return  null;
        }
        else
        {
            for (int i=0;i<userDtos.size();i++)
            {

                //用户编码
                ctripBigUsers.add(convertToSingleCtripBigUser(userDtos.get(i),orgPk,tenant));


            }
        }
        return ctripBigUsers;
    }

    public static CtripBigUser convertToSingleCtripBigUser(UcUserDto userDto,String orgPk,String tenant)
    {
        List<CtripBigUser> ctripBigUsers=new ArrayList<>();
        if(userDto==null)
        {
            return  null;
        }
        else
        {
            CtripBigUser ctripBigUser=new CtripBigUser();
            //用户编码
            ctripBigUsers.add(ctripBigUser);
            ctripBigUser.setUserCode(userDto.getUserCode());
            ctripBigUser.setUserName(userDto.getUserName());
            ctripBigUser.setValid(userDto.getValid());
            ctripBigUser.setEmail(userDto.getEmail());
            ctripBigUser.setDeptName(userDto.getDeptName());
            ctripBigUser.setDeptId(userDto.getDeptPk());
            ctripBigUser.setUserId(userDto.getUserId());
            ctripBigUser.setOrgName(userDto.getOrgName());
            ctripBigUser.setPostName(userDto.getPostName());
            ctripBigUser.setRankName(userDto.getRankName());
            ctripBigUser.setPersonCode(userDto.getPersonCode());
            ctripBigUser.setOrgPk(orgPk);
            ctripBigUser.setTenant(tenant);
            ctripBigUser.setPhone(userDto.getPhone());
            return ctripBigUser;
        }

    }
}
